const express = require('express')
const app = express()
// 获取本地ip
function getIPAddress() {
  const interfaces = require('os').networkInterfaces()
  for (let devName in interfaces) {
    const iface = interfaces[devName]
    for (let i = 0; i < iface.length; i++) {
      const alias = iface[i]
      if (
        alias.family === 'IPv4' &&
        alias.address !== '127.0.0.1' &&
        !alias.internal
      ) {
        return alias.address
      }
    }
  }
}
app.use('/', express.static(process.cwd() + '/public'))
app.listen(5555, () => {
  console.log('http://' + getIPAddress() + ':5555/')
})
